import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
  ],
  css: {
    preprocessorOptions: {
      scss: { 
        additionalData: `
          @import "@/assets/scss/variable.scss";
        `
      }
    }
  },
  resolve: {
    // vue3中添加扩展，否则在一些js文件中引入vue模板或者其他文件会报错
    extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.vue'],
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})
